//
//  TopCollectionCell.m
//  时光电影项目
//
//  Created by 墨狂之逸才 on 15/7/21.
//  Copyright (c) 2015年 墨狂之逸才. All rights reserved.
//

#import "TopCollectionCell.h"
#import "UIImageView+WebCache.h"
#import "StartView.h"
#import "TopModal.h"
@implementation TopCollectionCell

- (void)awakeFromNib {
    
    [self setNeedsLayout];
    
}

#pragma mark - 从写set方法到底有什么用？？？？？
- (void)setTopModal:(TopModal *)topModal
{
    _topModal = topModal;
    [self setNeedsLayout];
}

#pragma mark -layoutSubviews
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    //将模型数据的内容传给cell
    _title.text = self.topModal.title;



    NSString *average = [NSString stringWithFormat:@"%.1f", self.topModal.average];
    _average.text = average;
    
    

//    self.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"poster_title_home"]];
    
    //获取网络的图片，调用第三方库的方法
    NSString *medium = [self.topModal.images objectForKey:@"medium"];
    [_iconImage sd_setImageWithURL:[NSURL URLWithString:medium]];
    
    
    
//    _startView.average = self.topModal.average;

    
    
//    StartView *view = (StartView *) self.startView;
//    view.average = self.topModal.average;
    
    
    
    
    
    
    
    //设置全局的cell不被选中的样式
//    self.selectionStyle = UITableViewCellSelectionStyleNone;
    //添加评分的星星图标
    //    UIImage *image1 = [UIImage imageNamed:@"yellow"];
    //    UIImage *image2 = [UIImage imageNamed:@"gray"];
    //
    //
    //    UIView *view1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, image1.size.width*(self.movieModal.average-5), image1.size.height)];
    //    UIView *view2 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, image2.size.width*5, image2.size.height)];
    //
    //
    //    view1.backgroundColor = [UIColor colorWithPatternImage:image1];
    //    view2.backgroundColor = [UIColor colorWithPatternImage:image2];
    //
    //    [self.startView addSubview:view2];
    //    [self.startView addSubview:view1];

}

@end
